﻿using System.Xml.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using unTroublemaker.Parsing;

namespace unTroublemaker.Tests.Parsing
{
    [TestClass]
    public class InvertConditionParserTests
    {
        private SpecificationParser _specificationParser;
        private InvertConditionParser _notParserTests;

        public TestContext TestContext { get; set; }

        [TestInitialize]
        public void Initialize()
        {
            _specificationParser = new SpecificationParser();
            _notParserTests = new InvertConditionParser();
        }

        [TestMethod, TestCategory("UnitTest")]
        public void GivenANotConditionWithASingleSubConditionCanParse()
        {
            var not = new XElement("not", new XElement("check-file-exists", new XAttribute("path", "does not exist")));

            var condition = _notParserTests.Parse(not, _specificationParser);
            condition.Run();
            Assert.IsTrue(condition.Passed);
        }
    }
}
